package edu.sctu.zhengsenwen.month201506.day20150611.Array;


/**
 * Created by user15 on 2015/6/11.
 */
public class C04E01 {

    public static void main(String[] args) {

        int grades[];
        grades = new int[5];

        grades[0] = 80;
        grades[0] = 82;
        grades[0] = 81;
        grades[0] = 85;
        grades[0] = 83;


        getMaxAndMin(grades);

    }

    public static void getMaxAndMin(int grades[]) {

        int max = grades[0];

        int min = grades[0];

        for (int i = 0; i < grades.length; i++) {


            if (grades[i] > max) {

                max = grades[i];
            }


            if (grades[i] < min) {

                min = grades[0];
            }
        }

        System.out.println("最大值："+max);
        System.out.println("最小值："+min);

    }

}
